BUG: clearer HDFStore error for min_itemsize on MultiIndex columns (GH-12154)#65602
Open
jbrockmendel wants to merge 2 commits into
Open
BUG: clearer HDFStore error for min_itemsize on MultiIndex columns (GH-12154)#65602jbrockmendel wants to merge 2 commits into
jbrockmendel wants to merge 2 commits into
Conversation
…H#12154)
Per-column min_itemsize is unsupported with MultiIndex columns because
data_columns themselves are unsupported on that axis. Previously the
user hit one of two opaque errors ("not an axis or data_column" for a
level-0 key, "cannot have non-object label DataIndexableCol" for a tuple
key). Surface the actual constraint up front in validate_data_columns
and point users at the min_itemsize={'values': N} workaround.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
min_itemsizeis fundamentally unsupported for DataFrames withMultiIndexcolumns becausedata_columnsare unsupported on that axis. Today the constraint is hit accidentally and emits one of two opaque errors:min_itemsize={1: 20}→"min_itemsize has the key [1] which is not an axis or data_column"min_itemsize={(1, 'a'): 20}→"cannot have non-object label DataIndexableCol"validate_data_columnsand point users at the workingmin_itemsize={'values': N}form.closes #12154
Test plan
test_append_min_itemsize_multiindex_columnscovering the level-0-key form, the tuple-key form, and the'values'round-trip.pandas/tests/io/pytables/test_append.pypasses locally.🤖 Generated with Claude Code